#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int t[8] = {0};
    for (int i=1; i<=7; ++i)
    {
        int s, m;
        cin >> s >> m;
        t[i] = s + m - 8;
    }
    int mt = 0, md = 0;
    for (int i=1; i<=7; ++i)
    {
        if (t[i] > mt) {mt = t[i]; md = i;}
    }

    cout << md;
    return 0;
}
